package Po;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;

public class dbInfo {
	static String dbName = "css";
	static String account = "root";
	static String password = "youhua333";
	static String fileUrl = ".\\data\\dbInfo.txt";
	static {
		try {
			Scanner in = new Scanner(new File(fileUrl));
			dbName = in.nextLine();
			account = in.nextLine();
			password = in.nextLine();
			in.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
		}
	}

	public static String getDbName() {
		return dbName;
	}

	public static String getAccount() {
		return account;
	}

	public static String getPassword() {
		return password;
	}


	public static void reset(String newDbName, String newAccount,
			String newPassword) {
		dbName = newDbName;
		account = newAccount;
		password = newPassword;
		try {
           PrintWriter  out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File(fileUrl))));
           out.println(dbName);
           out.println(account);
           out.println(password);
           out.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
